package org.greyhawk.samonitor.domain;

import java.lang.String;
import java.lang.SuppressWarnings;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.greyhawk.samonitor.domain.Site;

privileged aspect Site_Roo_Finder {
    
    @SuppressWarnings("unchecked")
    public static Query Site.findSitesByUrlPath(String urlPath) {
        if (urlPath == null || urlPath.length() == 0) throw new IllegalArgumentException("The urlPath argument is required");
        EntityManager em = Site.entityManager();
        Query q = em.createQuery("SELECT Site FROM Site AS site WHERE site.urlPath = :urlPath");
        q.setParameter("urlPath", urlPath);
        return q;
    }
    
    @SuppressWarnings("unchecked")
    public static Query Site.findSitesByMainSite(Site mainSite) {
        if (mainSite == null) throw new IllegalArgumentException("The mainSite argument is required");
        EntityManager em = Site.entityManager();
        Query q = em.createQuery("SELECT Site FROM Site AS site WHERE site.mainSite = :mainSite");
        q.setParameter("mainSite", mainSite);
        return q;
    }
    
}
